home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 December / PCWorld_2007-12_cd.bin / domacnost a kancelar / autoit / autoit-v3-setup.exe / Examples / Helpfile / _GUICtrlStatusBarGetRect.au3 < prev    next >
Text File  |  2007-09-08  |  2KB  |  53 lines

  1. Opt("MustDeclareVars", 1)
  2.  
  3. #include <GUIConstants.au3>
  4. #Include <GuiStatusBar.au3>
  5.  
  6. Local $gui, $StatusBar1, $msg
  7. Local $a_PartsRightEdge[4] = [100, 200, 350, -1]
  8. Local $a_PartsText[4] = ["New Text", "More Text", "Even More Text", "Hey some more"]
  9.  
  10. ;================================================================
  11. ; Example 1 - Using AutoIt Control
  12. ;================================================================
  13. $gui = GUICreate("Status Bar Get Rect", 500, -1, -1, -1, $WS_SIZEBOX)
  14. $StatusBar1 = _GUICtrlStatusBarCreate($gui, $a_PartsRightEdge, $a_PartsText)
  15.  
  16. For $x = 0 To 3
  17.     _GetRectInformation($StatusBar1, $x)
  18. Next
  19.  
  20. GUISetState(@SW_SHOW)
  21.  
  22.  
  23. While 1
  24.     $msg = GUIGetMsg()
  25.     Select
  26.         Case $msg = $GUI_EVENT_RESIZED
  27.             _GUICtrlStatusBarResize($StatusBar1)
  28.         Case $msg = $GUI_EVENT_CLOSE
  29.             ExitLoop
  30.         Case Else
  31.             ;;;;;
  32.     EndSelect
  33.     
  34. WEnd
  35. GUIDelete()
  36.  
  37. ;================================================================
  38. ; Example 2 - External Control
  39. ;================================================================
  40. Opt("WinTitleMatchMode", 4)
  41. Local $h_win = WinGetHandle("classname=SciTEWindow")
  42. Local $h_status = ControlGetHandle($h_win, "", "msctls_statusbar321")
  43. Local $v_rect = _GUICtrlStatusBarGetRect($h_status, 0)
  44. ConsoleWrite("Left: " & $v_rect[0] & @LF & _
  45.         "Top: " & $v_rect[1] & @LF & _
  46.         "Right: " & $v_rect[2] & @LF & _
  47.         "Bottom: " & $v_rect[3] & @LF)
  48.  
  49.  
  50. Func _GetRectInformation(ByRef $StatusBar1, ByRef $i_part)
  51.     Local $a_rect = _GUICtrlStatusBarGetRect($StatusBar1, $i_part)
  52.     If IsArray($a_rect) Then _GUICtrlStatusBarSetText($StatusBar1, $a_rect[0] & "," & $a_rect[1] & "," & $a_rect[2] & "," & $a_rect[3], $i_part)
  53. EndFunc   ;==>_GetRectInformation